import React from "react";

export const StateExample = (props: any) => {
    const [number, setNumber] = React.useState(0);
    React.useEffect(() => {
        console.log("监听number的变化，此时的number为： " + number);
    }, [number]);
    const handleClick = () => {
        setNumber(1);
    };
    return (
        <div>
            <span>{number}</span>
            <button onClick={handleClick}>number++</button>
        </div>
    );
};
